<template>
  <div id="articleList">
    <header>
      <span :class="{Actions:top_tap==1}" @click="newest(1)">最新发布</span>
      <span :class="{Actions:top_tap==2}" @click="newest(2)">回答最多</span>
    </header>
    <article>
      <section v-for="(item,index) in article_list" :key="index">
        <Row>
          <Col span="24">
            <router-link :to="{name:'CommunityQuestionDeatil'}" @click="articleClick(item.Id)">
              <span :class="['No1_lable','No2_lable',''][item.IsTop]">
                {{['置顶','精华',''][item.IsTop]}}</span>
              <span class="title_show">{{item.Title}}</span>
            </router-link>
          </Col>
        </Row>
        <Row class="footer">
            <Col span="12" class="text-a-l footer_left">
              <span class="">{{item.User.LoginName}}</span>
               <time>发表于 {{item.User.LoginTime}}</time>
            </Col>
            <Col span="12" class="text-a-r footer_right">
              <span><b class="read"></b>{{item.ReadNum}}</span>
              <span><b class="reply"></b>{{item.ReplyNum}}</span>
            </Col>
        </Row>
      </section>
      <footer>
          <section>
            <span @click="getData">点击加载更多</span>
            <Loading :types="1" :show="loading"></Loading>
          </section>
      </footer>
    </article>
  </div>
</template>
<script>
  import Header from 'components/menu/header'
  import Content from 'components/home/content'
  import userIcon from 'assets/img/u235.png'
  import Loading from 'components/modules/animations/loading'
  import {updateArticle_object} from 'public/options'
  import Api from 'public/req_api' 
  import { mapActions,mapState } from "vuex";

  export default{
    name:'articleList',
    components:{Loading},
    data(){
      return{
        top_tap:1,
        loading:true
      }
    },computed:{
      ...mapState(['menuActive','article_list','classBlock_ID','iPage'])
    },methods:{
      ...mapActions(['updateArticle_id','update_blockID','updatePagination']),
      top_tab(index){
        this.top_tap = index;
      },
      newest(index){

        this.top_tab(index)
        this.getArticleData(index);
      },getArticleData(sort){

        this.$store.dispatch('update_blockID',updateArticle_object('',this,sort))
      },articleClick(articleID){
        this.$store.dispatch('updateArticle_id',articleID)
      },
      getData(){
        let Pages =  this.iPage
        this.$store.dispatch('updatePagination',Pages)
      }
    },created(){
    }
  }

</script>